#!/usr/bin/env python3
import sys

lengths = {
    2: 1,
    4: 4,
    3: 7,
    7: 8
}

unique = 0
for line in sys.stdin:
    if '|' not in line: continue
    for token in line.split('|')[1].split():
        if len(token) in lengths.keys():
            unique += 1
            print(f'token {token}, length {len(token)}, segment {lengths[len(token)]}')

print(f'{unique} unique digits')
